﻿using System;
using System.Runtime.InteropServices;
using System.Text;

namespace Valve.VR
{
	// Token: 0x02000794 RID: 1940
	public class CVRRenderModels
	{
		// Token: 0x06002EE5 RID: 12005 RVA: 0x000F37B4 File Offset: 0x000F19B4
		internal CVRRenderModels(IntPtr pInterface)
		{
			this.FnTable = (IVRRenderModels)Marshal.PtrToStructure(pInterface, typeof(IVRRenderModels));
		}

		// Token: 0x06002EE6 RID: 12006 RVA: 0x000F37D8 File Offset: 0x000F19D8
		public EVRRenderModelError LoadRenderModel_Async(string pchRenderModelName, ref IntPtr ppRenderModel)
		{
			return this.FnTable.LoadRenderModel_Async(pchRenderModelName, ref ppRenderModel);
		}

		// Token: 0x06002EE7 RID: 12007 RVA: 0x000F37FC File Offset: 0x000F19FC
		public void FreeRenderModel(IntPtr pRenderModel)
		{
			this.FnTable.FreeRenderModel(pRenderModel);
		}

		// Token: 0x06002EE8 RID: 12008 RVA: 0x000F3810 File Offset: 0x000F1A10
		public EVRRenderModelError LoadTexture_Async(int textureId, ref IntPtr ppTexture)
		{
			return this.FnTable.LoadTexture_Async(textureId, ref ppTexture);
		}

		// Token: 0x06002EE9 RID: 12009 RVA: 0x000F3834 File Offset: 0x000F1A34
		public void FreeTexture(IntPtr pTexture)
		{
			this.FnTable.FreeTexture(pTexture);
		}

		// Token: 0x06002EEA RID: 12010 RVA: 0x000F3848 File Offset: 0x000F1A48
		public EVRRenderModelError LoadTextureD3D11_Async(int textureId, IntPtr pD3D11Device, ref IntPtr ppD3D11Texture2D)
		{
			return this.FnTable.LoadTextureD3D11_Async(textureId, pD3D11Device, ref ppD3D11Texture2D);
		}

		// Token: 0x06002EEB RID: 12011 RVA: 0x000F386C File Offset: 0x000F1A6C
		public EVRRenderModelError LoadIntoTextureD3D11_Async(int textureId, IntPtr pDstTexture)
		{
			return this.FnTable.LoadIntoTextureD3D11_Async(textureId, pDstTexture);
		}

		// Token: 0x06002EEC RID: 12012 RVA: 0x000F3890 File Offset: 0x000F1A90
		public void FreeTextureD3D11(IntPtr pD3D11Texture2D)
		{
			this.FnTable.FreeTextureD3D11(pD3D11Texture2D);
		}

		// Token: 0x06002EED RID: 12013 RVA: 0x000F38A4 File Offset: 0x000F1AA4
		public uint GetRenderModelName(uint unRenderModelIndex, StringBuilder pchRenderModelName, uint unRenderModelNameLen)
		{
			return this.FnTable.GetRenderModelName(unRenderModelIndex, pchRenderModelName, unRenderModelNameLen);
		}

		// Token: 0x06002EEE RID: 12014 RVA: 0x000F38C8 File Offset: 0x000F1AC8
		public uint GetRenderModelCount()
		{
			return this.FnTable.GetRenderModelCount();
		}

		// Token: 0x06002EEF RID: 12015 RVA: 0x000F38E8 File Offset: 0x000F1AE8
		public uint GetComponentCount(string pchRenderModelName)
		{
			return this.FnTable.GetComponentCount(pchRenderModelName);
		}

		// Token: 0x06002EF0 RID: 12016 RVA: 0x000F3908 File Offset: 0x000F1B08
		public uint GetComponentName(string pchRenderModelName, uint unComponentIndex, StringBuilder pchComponentName, uint unComponentNameLen)
		{
			return this.FnTable.GetComponentName(pchRenderModelName, unComponentIndex, pchComponentName, unComponentNameLen);
		}

		// Token: 0x06002EF1 RID: 12017 RVA: 0x000F392C File Offset: 0x000F1B2C
		public ulong GetComponentButtonMask(string pchRenderModelName, string pchComponentName)
		{
			return this.FnTable.GetComponentButtonMask(pchRenderModelName, pchComponentName);
		}

		// Token: 0x06002EF2 RID: 12018 RVA: 0x000F3950 File Offset: 0x000F1B50
		public uint GetComponentRenderModelName(string pchRenderModelName, string pchComponentName, StringBuilder pchComponentRenderModelName, uint unComponentRenderModelNameLen)
		{
			return this.FnTable.GetComponentRenderModelName(pchRenderModelName, pchComponentName, pchComponentRenderModelName, unComponentRenderModelNameLen);
		}

		// Token: 0x06002EF3 RID: 12019 RVA: 0x000F3974 File Offset: 0x000F1B74
		public bool GetComponentState(string pchRenderModelName, string pchComponentName, ref VRControllerState_t pControllerState, ref RenderModel_ControllerMode_State_t pState, ref RenderModel_ComponentState_t pComponentState)
		{
			if (Environment.OSVersion.Platform == PlatformID.MacOSX || Environment.OSVersion.Platform == PlatformID.Unix)
			{
				VRControllerState_t_Packed vrcontrollerState_t_Packed = new VRControllerState_t_Packed(pControllerState);
				CVRRenderModels.GetComponentStateUnion getComponentStateUnion;
				getComponentStateUnion.pGetComponentStatePacked = null;
				getComponentStateUnion.pGetComponentState = this.FnTable.GetComponentState;
				bool result = getComponentStateUnion.pGetComponentStatePacked(pchRenderModelName, pchComponentName, ref vrcontrollerState_t_Packed, ref pState, ref pComponentState);
				vrcontrollerState_t_Packed.Unpack(ref pControllerState);
				return result;
			}
			return this.FnTable.GetComponentState(pchRenderModelName, pchComponentName, ref pControllerState, ref pState, ref pComponentState);
		}

		// Token: 0x06002EF4 RID: 12020 RVA: 0x000F3A00 File Offset: 0x000F1C00
		public bool RenderModelHasComponent(string pchRenderModelName, string pchComponentName)
		{
			return this.FnTable.RenderModelHasComponent(pchRenderModelName, pchComponentName);
		}

		// Token: 0x06002EF5 RID: 12021 RVA: 0x000F3A24 File Offset: 0x000F1C24
		public uint GetRenderModelThumbnailURL(string pchRenderModelName, StringBuilder pchThumbnailURL, uint unThumbnailURLLen, ref EVRRenderModelError peError)
		{
			return this.FnTable.GetRenderModelThumbnailURL(pchRenderModelName, pchThumbnailURL, unThumbnailURLLen, ref peError);
		}

		// Token: 0x06002EF6 RID: 12022 RVA: 0x000F3A48 File Offset: 0x000F1C48
		public uint GetRenderModelOriginalPath(string pchRenderModelName, StringBuilder pchOriginalPath, uint unOriginalPathLen, ref EVRRenderModelError peError)
		{
			return this.FnTable.GetRenderModelOriginalPath(pchRenderModelName, pchOriginalPath, unOriginalPathLen, ref peError);
		}

		// Token: 0x06002EF7 RID: 12023 RVA: 0x000F3A6C File Offset: 0x000F1C6C
		public string GetRenderModelErrorNameFromEnum(EVRRenderModelError error)
		{
			IntPtr ptr = this.FnTable.GetRenderModelErrorNameFromEnum(error);
			return Marshal.PtrToStringAnsi(ptr);
		}

		// Token: 0x04002AE4 RID: 10980
		private IVRRenderModels FnTable;

		// Token: 0x02000795 RID: 1941
		// (Invoke) Token: 0x06002EF9 RID: 12025
		[UnmanagedFunctionPointer(CallingConvention.StdCall)]
		internal delegate bool _GetComponentStatePacked(string pchRenderModelName, string pchComponentName, ref VRControllerState_t_Packed pControllerState, ref RenderModel_ControllerMode_State_t pState, ref RenderModel_ComponentState_t pComponentState);

		// Token: 0x02000796 RID: 1942
		[StructLayout(LayoutKind.Explicit)]
		private struct GetComponentStateUnion
		{
			// Token: 0x04002AE5 RID: 10981
			[FieldOffset(0)]
			public IVRRenderModels._GetComponentState pGetComponentState;

			// Token: 0x04002AE6 RID: 10982
			[FieldOffset(0)]
			public CVRRenderModels._GetComponentStatePacked pGetComponentStatePacked;
		}
	}
}
